<template>
  <a-modal
    title="服务结束"
    :visible="endVisible"
    :confirm-loading="endLoading"
    :footer="null"
    @cancel="handleCancel"
    width="600px"
  >
    <a-form-model
      :labelCol="{ span: 4 }"
      :model="params"
      :wrapperCol="{ span: 20 }"
      ref="editform"
      :rules="rules"
      labelAlign="left"
      :colon="false"
    >
      <a-form-model-item label="服务包">
        <p>{{ params.serviceName }}</p>
      </a-form-model-item>
      <a-form-model-item label="服务包描述">
        <p>{{ params.packageDesc }}</p>
      </a-form-model-item>
      <a-form-model-item label="服务成效">
        <!-- <p>{{ params.manageEffect }}</p> -->
        <a-radio-group v-model="quitParams.manageEffect">
          <a-radio v-for="item in params.manageEffect" :key="item.effectId" :value="item.effectName">{{
            item.effectName
          }}</a-radio>
        </a-radio-group>
      </a-form-model-item>
      <a-form-model-item label="执行人">
        <p>{{ doctor.realname }}</p>
      </a-form-model-item>
      <a-form-model-item label="备注">
        <a-input type="textarea" v-model="quitParams.serviceEndDesc"></a-input>
      </a-form-model-item>
      <a-row>
        <a-col :span="20" align="right">
          <a-button type="default" @click="handleCancel1">
            取消
          </a-button>
        </a-col>
        <a-col :span="4" align="right">
          <a-button type="primary" @click="handleOk1">
            确定
          </a-button>
        </a-col>
      </a-row>
    </a-form-model>
  </a-modal>
</template>

<script>
import { getAction, postAction, deleteAction } from '@/api/manage'
export default {
  name: 'QuitModal',
  data() {
    return {
      endVisible: false,
      endLoading: false,
      quitParams: {},
      params: {},
      doctor: {}
    }
  },
  created() {
    this.doctor.realname = JSON.parse(localStorage.getItem('pro__Login_Userinfo')).value.realname
    this.doctor.doctorId = JSON.parse(localStorage.getItem('pro__Login_DoctorId')).value
  },
  methods: {
    edit(record) {
      this.endVisible = true
      this.params = Object.assign({}, record)
    },
    handleCancel() {
      this.endVisible = false
    },
    handleCancel1() {
      this.endVisible = false
    },
    handleOk1() {
      postAction('107/03/1070319', {
        executorId: this.doctor.doctorId,
        executorName: this.doctor.realname,
        serviceEffect: this.quitParams.manageEffect,
        serviceEndDesc: this.quitParams.serviceEndDesc,
        servicePackageId: this.params.servicePackageId
      }).then(res => {
        this.$emit('ok')
        this.endVisible = false
      })
    }
  }
}
</script>

<style></style>

